package com.ruoyi.coupon.mapper;

import com.ruoyi.coupon.domain.PmsCoupon;
import com.ruoyi.coupon.domain.PmsOrder;
import com.ruoyi.coupon.domain.PmsUserCoupon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface PmsCouponMapper {

    List<PmsCoupon> selectHomePageCoupon(@Param("recommendStatus") Integer recommendStatus, @Param("userId") Long userId, @Param("nowDate") Date nowDate);

    PmsCoupon selectCouponInfo(Long couponId);

    void receiveCoupon(PmsUserCoupon pmsUserCoupon);

    void updateGrantNum(Long couponId);

    List<PmsCoupon> selectCouponBySkuId(@Param("skuId") Long skuId, @Param("userId") Long userId, @Param("nowDate") Date nowDate);

    List<PmsCoupon> selectCouponByCart(@Param("skuId") Long skuId, @Param("userId") Long userId, @Param("nowDate") Date nowDate);

    List<PmsCoupon> selectUserCoupon(@Param("userId") Long userId, @Param("status") Long status);

    List<PmsCoupon> selectCouponByOrder(Long userId);

    PmsUserCoupon selectUserCouponInfo(@Param("userId") Long userId, @Param("couponId") Long couponId);

    void generateOrder(PmsOrder pmsOrder);

    void updateOrderStatus(@Param("orderId") Long orderId, @Param("orderStatus") Long orderStatus);

    void updateMyCouponStatus(@Param("userId") Long userId, @Param("orderId") Long orderId , @Param("status") Long status);

    void updateSkuInventory(@Param("skuId") Long skuId, @Param("skuNum") Long skuNum);

}
